UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ln3lpVyywHl7v6pahjfA1BdBLG/tV/CXHy2VQlHxPHM=' 
WHERE 
  key_id = 'a89e4dbb2c9298781a0f9efa8df6e66280bfca26476cf6d0d16725f9adf2b441' 
  AND (
    token = 'ln3lpVyywHl7v6pahjfA1BdBLG/tV/CXHy2VQlHxPHM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030