UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KpaKVHwCDmqN5HD5Uj+V6XIwhpidZoKxcInQLvtzCB0=' 
WHERE 
  key_id = '81621150d0423388fa0c6e1f5dec8ae2c99ba0994536bbaf2401127a3846e59e' 
  AND (
    token = 'KpaKVHwCDmqN5HD5Uj+V6XIwhpidZoKxcInQLvtzCB0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030