UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iWYu8ZM3V8k40bdy4DftaM42fLzMYicKRX54nugTH60=' 
WHERE 
  key_id = '1fd1e4d0c1b404636c9637710400769396d8b9268033142b12d5915eb8b447b2' 
  AND (
    token = 'iWYu8ZM3V8k40bdy4DftaM42fLzMYicKRX54nugTH60=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050