UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+IwnhPcnA+YdkLkSubDxABjf/f7KH+vGlzWAhAdIBfQ=' 
WHERE 
  key_id = 'fe6c77e74adb44e22712e7d2bff91945777112314529b7361719b3393ad6dc56' 
  AND (
    token = '+IwnhPcnA+YdkLkSubDxABjf/f7KH+vGlzWAhAdIBfQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029