UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f0LR2HSWXrFlV5M9cEFsBvaGJ4rdhDjdnwTUzc4v9Nc=' 
WHERE 
  key_id = 'ea5648c96d3fa3fd5b9a1705ba4e15c1f1a6421dce8ac30c1eca46b3825f24c2' 
  AND (
    token = 'f0LR2HSWXrFlV5M9cEFsBvaGJ4rdhDjdnwTUzc4v9Nc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032