UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '35f4K0MM5KdV+ZLlv+kWxKQv55r6XVW/ffb+7jwqTaM=' 
WHERE 
  key_id = '7f9378abc9ae193bd3671693ae9996c400fe20dc030382f85c247f15629f8d9f' 
  AND (
    token = '35f4K0MM5KdV+ZLlv+kWxKQv55r6XVW/ffb+7jwqTaM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035