UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Yq6wihZc+c6Lj2WVZVMvXyF67OwqxdQZ0FXKigoOPms=' 
WHERE 
  key_id = '795d31d8c129c5afb1ba72aa95d41dac6826cd69e51d7cd2f1b7e068f22a8b0f' 
  AND (
    token = 'Yq6wihZc+c6Lj2WVZVMvXyF67OwqxdQZ0FXKigoOPms=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021