UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HlE9hCy0ktMuETJPqabLEmEQJrYIAq+6BIdDGR+7ymY=' 
WHERE 
  key_id = '82bd4b8aa5ff36704828b235faf7dac8b4fd39e996330e612e024f26db156688' 
  AND (
    token = 'HlE9hCy0ktMuETJPqabLEmEQJrYIAq+6BIdDGR+7ymY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043