UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sGd/ZXD7GKIM+qIecmraxIVCbrT7+tfE4bhDsvWdRek=' 
WHERE 
  key_id = 'caa7126f8cd251936d77e33771b1ff4401d67dc0dc6033b8c5d23d8bfc0a8bfd' 
  AND (
    token = 'sGd/ZXD7GKIM+qIecmraxIVCbrT7+tfE4bhDsvWdRek=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023