UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T8WC/jHP5+hk5GHh1ZKI0Xh3LrRIwT4wGhOpu+GZ8G4=' 
WHERE 
  key_id = '423b2a5e0db1142f3f698120552cfff606226d045151e6de4a14672546f12186' 
  AND (
    token = 'T8WC/jHP5+hk5GHh1ZKI0Xh3LrRIwT4wGhOpu+GZ8G4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018