UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cYMD8zvqLAiRCJsPRyhJwBlITJHu5jQBnk9hHHQ/xJ4=' 
WHERE 
  key_id = 'd89d03fa26ecbad1a2790e5d950348dbc33e01181aa250d8494aa9971fb4894d' 
  AND (
    token = 'cYMD8zvqLAiRCJsPRyhJwBlITJHu5jQBnk9hHHQ/xJ4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030