UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hosJw5g2LChpK0Lnr9GhHRnF4mpvRrXgyT3n98tu+uo=' 
WHERE 
  key_id = '0d1243cf1739c622b964428cebe45d44323e3dacee9268753ff5ceb2bfa2583f' 
  AND (
    token = 'hosJw5g2LChpK0Lnr9GhHRnF4mpvRrXgyT3n98tu+uo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034