UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NzdBYaue2rEP4KTVmctAkvw/fEtd/f4zmMO7Aqfp3oQ=' 
WHERE 
  key_id = '5d0cfe5b4b0bca94e8ed9b74327f2f4741a9e27147ecbcb8443bcc59d320288f' 
  AND (
    token = 'NzdBYaue2rEP4KTVmctAkvw/fEtd/f4zmMO7Aqfp3oQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028