UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SFKvXnqAA2Irb1tcDeK8B7geHiS4dBs0Got3eE0l97M=' 
WHERE 
  key_id = '5882cb2797052d82d6768005fc9f37aa6f8fe982d306da847fa3050047e40da9' 
  AND (
    token = 'SFKvXnqAA2Irb1tcDeK8B7geHiS4dBs0Got3eE0l97M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030