UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XAbBTsNVyR3qyVYf5UUN/1N2y76atcCnLiMbbxFwg78=' 
WHERE 
  key_id = 'b837468e2d79d6a02d4749853b6647ecce7576770f5d40a3a80f1a853b2ea579' 
  AND (
    token = 'XAbBTsNVyR3qyVYf5UUN/1N2y76atcCnLiMbbxFwg78=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041