UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c3eK+YuIQ7UUuB4ouyfxqlRlwOLC/SjRxWbVWeXazeA=' 
WHERE 
  key_id = '900962bcf4613d29618d675442b5b9d107098b53c9cc4046dffacdd39c678aee' 
  AND (
    token = 'c3eK+YuIQ7UUuB4ouyfxqlRlwOLC/SjRxWbVWeXazeA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043