UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8hHzwBscjrYG/501nnwqfIl5tVw+NBFqxB3+OkEEULo=' 
WHERE 
  key_id = '16b380c9e44a317852a8d375e60b30ee99d546720d9a4124576f018477ce5942' 
  AND (
    token = '8hHzwBscjrYG/501nnwqfIl5tVw+NBFqxB3+OkEEULo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030