UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tLFpLExTGgj/8W5Ym5rHozM7JyADnzMlK+ZUwpTnNUo=' 
WHERE 
  key_id = '3068c34cee48771096182be7a49991cb7435106a989cf9216a467cb6662267cb' 
  AND (
    token = 'tLFpLExTGgj/8W5Ym5rHozM7JyADnzMlK+ZUwpTnNUo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030