UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zqAYYlyjXx+qQGPSvqSjJgNzm1PZ/Ui6bwf5Of3TPl0=' 
WHERE 
  key_id = '3a4f07d719f0e7d0a3569b202e929707aba95265667127d59c3f360921f24b21' 
  AND (
    token = 'zqAYYlyjXx+qQGPSvqSjJgNzm1PZ/Ui6bwf5Of3TPl0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022