UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XmmuTE1UXY+RNX9jm2jASyV3sqHWOc1UaOD5D4MPBI0=' 
WHERE 
  key_id = '21a127fa924643487e32d11401b1539e118645c403f60a16207b952843dd92d5' 
  AND (
    token = 'XmmuTE1UXY+RNX9jm2jASyV3sqHWOc1UaOD5D4MPBI0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041