UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QGNn9lYMx/KCVkzsNFsO48Pga6w9NFAs0j53RVMUI2E=' 
WHERE 
  key_id = '867fae29fef957ad692593f468902d461172fa55a9464054518492971d5d610d' 
  AND (
    token = 'QGNn9lYMx/KCVkzsNFsO48Pga6w9NFAs0j53RVMUI2E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032