UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WnRQOOHw1jTcGJaESF7419DRGlZyjpZ/EKMFLgSHGcI=' 
WHERE 
  key_id = '1b90975236ac61ab05fca61688aafe8482b9e6673920988e117cf33e9ebb2b86' 
  AND (
    token = 'WnRQOOHw1jTcGJaESF7419DRGlZyjpZ/EKMFLgSHGcI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044