UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VXVZvdULVvki8ZazAjb55hga40xJm+iUXrxXp9BYMHI=' 
WHERE 
  key_id = '678bbaf22b5e4859e598917a865b32d4e614ccf04f67bb9676f735b793e5e06e' 
  AND (
    token = 'VXVZvdULVvki8ZazAjb55hga40xJm+iUXrxXp9BYMHI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035