UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5y4rWsYLetAHIzj2gboDJ5Vax4omgarBVRv+PjyMOZU=' 
WHERE 
  key_id = '1901bfb93c97a23c6dbddc4bdf97c58a1acb389389dbddf85b3e56451004b8af' 
  AND (
    token = '5y4rWsYLetAHIzj2gboDJ5Vax4omgarBVRv+PjyMOZU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031