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

Query time 0.00078