UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U6tit2ypxyP+ehU59MFVIpKZmyBlHSs+iLlnDvO38sw=' 
WHERE 
  key_id = '2b5e454b1b029853d142c53d4503fe3d6a8b66550715a2066d86b3f29563e491' 
  AND (
    token = 'U6tit2ypxyP+ehU59MFVIpKZmyBlHSs+iLlnDvO38sw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038