UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hgQXP42ONriAmmJCrMrKRR201hcQ2JfxPGhWVsUQ/oY=' 
WHERE 
  key_id = 'af265305d2faa73195f2d4dcd320ec8fa2510f90deb4cf7bf4861db9305919ef' 
  AND (
    token = 'hgQXP42ONriAmmJCrMrKRR201hcQ2JfxPGhWVsUQ/oY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024