UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Uh8wtXUiGKCygcKGDfnwviVdl4KMPG7u1IXUnmcoJBU=' 
WHERE 
  key_id = 'a9109af57acaddcd8091ffcb0650c550840a872288522b7740826cb9f93c4bd6' 
  AND (
    token = 'Uh8wtXUiGKCygcKGDfnwviVdl4KMPG7u1IXUnmcoJBU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046