UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jyc9jeakS6aLis/HmtdF+K05KqXdgurSYVxO354tQfU=' 
WHERE 
  key_id = '876cce2017a33567b283dd13cb16e45739b586f9ec3affe27420ed2f9c25e246' 
  AND (
    token = 'jyc9jeakS6aLis/HmtdF+K05KqXdgurSYVxO354tQfU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035