UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6laWNIEyEMmm/UUtD5oqGbK9nLb56Ivb2jiWNwdw1lo=' 
WHERE 
  key_id = '3d22b3296664c01c2f13a2e1a40c03478450e2cefbdccb2445d9d82cb6438812' 
  AND (
    token = '6laWNIEyEMmm/UUtD5oqGbK9nLb56Ivb2jiWNwdw1lo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038