UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XYEfSfG9JhRH3s0lx+Q3qN6EJD7NTe+X9xVBYUkcEFk=' 
WHERE 
  key_id = 'a1a3d4f41b1f0a42709bca8b98ff48b1929810414cbf030d41b5b2af2f145ed9' 
  AND (
    token = 'XYEfSfG9JhRH3s0lx+Q3qN6EJD7NTe+X9xVBYUkcEFk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020