UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'srVupnHV1piH8YuEoHDu35auHQWmhnLGXtw5njX8QH0=' 
WHERE 
  key_id = '43cf166853e9e80b466669d030a3e8fa869ea3e5155d466603751d72ba4c8b39' 
  AND (
    token = 'srVupnHV1piH8YuEoHDu35auHQWmhnLGXtw5njX8QH0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00060