UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7lCJBFBz+RxpakezyED8x9b0xW/nKOpHN5gsEWxyKBQ=' 
WHERE 
  key_id = '418659804855860ab5f664ac83d69f8102bf9d768442da5c8059f98fcf42ef68' 
  AND (
    token = '7lCJBFBz+RxpakezyED8x9b0xW/nKOpHN5gsEWxyKBQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027