UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AEmkhrlKMKQhv0aPOhMCrh4I8UgiT1MkOkO+R32oOGs=' 
WHERE 
  key_id = '48fa240e6450d541377c6ffa3b4ccd8ba2022e25bad1e48e24cc4af87fc6af2c' 
  AND (
    token = 'AEmkhrlKMKQhv0aPOhMCrh4I8UgiT1MkOkO+R32oOGs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032