UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CoVOjzNopkSpjKpJKEATebhtubS3Yj56k51BJjjBgo0=' 
WHERE 
  key_id = '2e6420e036153e86d518cb5237788bc364e495480fc4990dd5d0393dcbe0d55d' 
  AND (
    token = 'CoVOjzNopkSpjKpJKEATebhtubS3Yj56k51BJjjBgo0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052