UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ofP7k/9YmD4+XxIoERAV2n8kt0dnGuSaFKHmnfjbbKM=' 
WHERE 
  key_id = 'f87e897dbf33af9a5f5158e3d80b144c2666fa7cd09cc159b2caadb1e3dd947e' 
  AND (
    token = 'ofP7k/9YmD4+XxIoERAV2n8kt0dnGuSaFKHmnfjbbKM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027